
<?php include "header.php";?>
	<div id="all">
		<?php
			$key = $_POST["key"];
			if(isset($key)) {
				$sqlArticles = "Select id, vi_title, en_title from tblarticle where vi_title LIKE '%".$key."%' OR en_title LIKE '%".$key."%' OR vi_content LIKE '%".$key."%' OR en_content LIKE '%".$key."%'";
				$rsArticles = mysql_query($sqlArticles) or die(mysql_error);
			}
		?>
		<div id="main">
			<div id="m-left">
				<div class="sidebar">
					<div class="title">
						<?php echo ($lang ==0)? "Danh mục" : "Menu";?>
					</div>
					<div class="content">
						<ul>
						<?php
							if($lang == 0){
								$sqlMenus = "select id, vi_name as name, url from tblmenu where parent_id =0";
							} else{
								$sqlMenus = "select id, en_name as name, url from tblmenu where parent_id =0";
							}
							$rsMenus = mysql_query($sqlMenus) or die(mysql_error());
							while($menu = mysql_fetch_object($rsMenus)){
								echo "<li><a href='".(($menu->url =="")? (ROOT_PATH."/m/".$menu->id) : ROOT_PATH.$menu->url)."'>".$menu->name."</a></li>";
							}
						?>
						</ul>
					</div>
				</div><!-- end of sidebar -->
			</div>
			<div id="m-mid">
				<div class="title">
					<?php
						if($lang == 0){
							echo "Kết quả tìm kiếm";
						}else{
							echo "Search Result";
						}
					?>
				</div>
				<div class="content">
					<ul>
						<?php 
						while($article = mysql_fetch_object($rsArticles)){
							if($lang==0){
								echo "<li><a href='".ROOT_PATH."/view/".$article->id."'>".$article->vi_title."</a></li>";
								
							}else{
								echo "<li><a href='".ROOT_PATH."/view/".$article->id."'>".$article->en_title."</a></li>";
							}
						}?>
					</ul>
					
				</div>
			</div>
			<div id="m-right">
			
				<div class="sidebar">
					<?php include "newest.php";?>
				</div><!-- end of sidebar -->	
				<?php include "loginlink.php";?>
			</div>
			<div class="clear-fix"></div>
		</div><!--  end of main -->
		<?php include "footer.php";?>
	</div>
</body>
</html>